import request from "./request";
import qs from "qs";
// 精品推荐数据接口
// export const GetAPI = () => {
// return request.get("/products/recommend");
// };

// 首页精品推荐请求
export const JingpinAPI = () => request.get("/products/recommend");
// 请求热门兑换的数据
export const RemenAPI = () => request.get("/products/hot");

// 发送验证码
export const SendSMSAPI = (params) => {
  return request.post("/sendSMS", qs.stringify(params));
};

// 手机验证码
export const PhoneLoginAPI = (params) => {
  return request.post("/phoneRegin", qs.stringify(params));
};

// 微信扫码登录请求
export const WeixinLoginAPI = (params) => {
  return request.post("/wechatUsers/PCLogin", qs.stringify(params));
};

// 手机绑定微信
export const BindPhoneAPI = (params) =>
  request.post(`/wechatUsers/binding`, qs.stringify(params));

export const UserProfilesAPI = () => {
  return request.get("/shop/userProfiles");
};

// 请求详情页的数据
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

// 加入到购物车
export const AddToCartApi = (params) =>
  request.post(`/shop/carts/add`, qs.stringify(params));

// 请求全部商品的接口
export const GoodsSearchApi = (params) => request.get(`/products`, { params });

// 请求购物车数据
export const CartDataApi = () => request.get(`/shop/carts`);

// 删除购物车接口
export const CartDelApi = (params) =>
  request.delete(`/shop/carts?productIds=${params.id}`);
